<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="format-detection" content="telephone=no" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <link rel="stylesheet" href="stylesheets/zui.min.css"/>
    <link rel="stylesheet" href="stylesheets/main.css" id="css"/>
    <script src="javascripts/jquery-1.10.1.min.js"></script>
    <script src="javascripts/zui.min.js"></script>
    <script src="javascripts/footer.js"></script>
    <title>斯迈普解盘侠</title>
    <style type="text/css">
    	.msgInputBox{
    		text-align: left;
    	}
    </style>
    <script type="text/javascript">
    	$(function(){
    		heartFun(false);
    		
    		var userInfo = getLocalUserInfo();
    		if(userInfo != null){
	    		$('#tel').val(userInfo.mphone);
				$('#email').val(userInfo.email);
				$('#nick').val(userInfo.nick);
    		}
    		var showMsgFun = function(msg){
    			$('.pageMsg').text(msg);
    		};
    		$('#set').click(function(){
    			window.location.href = 'shoutListSet.html';
    		});
    		
    		$('#saveBtn').click(function(){
    			showMsgFun('');
    			var nick = $('#nick').val();
    			var email = $('#email').val();
    			if($.trim(nick) == ''){
    				showMsgFun('昵称不能为空！');
    				return;
    			}
    			if($.trim(email) == ''){
    				showMsgFun('邮箱不能为空！');
    				return;
    			}else if(!/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/.test($.trim(email))){
    				showMsgFun('邮箱格式不正确！');
    				return;
    			}
    			//保存
    			$.ajax({
    				url:'../member/saveSelfMessage.do',
    				type:'post',
    				data:{
    					email:email,nick:nick
    				},
    				success:function(d){
    					if(d.success){
    						if(timer){
    							clearTimeout(timer);
    						}
    						showMsgFun('修改成功，等待跳转...');
    						setTimeout(function(){
    							window.location.href = 'selfMessage.html';
    						},3000);
    					} else {
    						showMsgFun(d.statusCode);
    					}
    				}
    			});
    			
    		});
    		
    		$('#backBtn').click(function(){
    			window.location.href = "selfMessage.html";
    		});
    	});
    	
    	  </script>
</head>
<body class="index">
<div class="container main">
    <div class="row messages-box ">
        <div class="col-xs-12">
            <table class="table">
                <tbody>
                <tr>
                    <td><img src="images/12.png" width="22px;"  height="20px;"/></td>
                    <td><input type="text" id="tel" disabled placeholder="联系电话" style="text-align:left;padding-left:5px;"/></td>
                </tr>
              
              
                <tr>
                    <td><img src="images/15.png"   width="22px;"  height="20px;"/></td>
                    <td><input type="text" id='nick' placeholder="昵称" style="text-align:left;padding-left:5px;"/></td>
                </tr>
                <tr>
                    <td><img src="images/13.png"  width="22px;"  height="20px;"/></td>
                    <td><input type="email" id='email' placeholder="我的邮箱" style="text-align:left;padding-left:5px;"/></td>
                </tr>
                </tbody>
            </table>
            <div class="row login-btn-box">
	            <div class="col-xs-12" style="text-align:center;">
	            	<button id="saveBtn" class="btn btn-danger" style="width:46%;">确定</button>
	            	<button id="backBtn" class="btn btn-danger" style="width:46%;">返回</button>
	            </div>
	        </div>
	         <div class="row register-btn-box">
	            <label class="pageMsg" style="color:green;"></label>
	        </div>
        </div>
    </div>

  <footer class="nav-footer">
			<div class="col-xs-3" id="hall" >
				<i class="icon icon-home"></i>
				<h4>解盘</h4>
			</div>
			<div class="col-xs-3" id="notify"  >
				<i class="icon icon-volume-up"></i>
				<h4>喊单</h4>
			</div>
			<div class="col-xs-3" id= "news" >
				<i class="icon icon-globe"></i>
				<h4>资讯</h4>
			</div>
			<div class="col-xs-3  footer-nav-active" id="my" >
				<i class="icon icon-user"></i>
				<h4>个人中心</h4>
			</div>
</footer>
</div>
<script src="javascripts/main.js"></script>
</body>
</html>